//
//  MarketDetail.m
//  RedManStock
//
//  Created by lanou3g on 15/8/1.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "MarketDetail.h"

@implementation MarketDetail


-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    if ([key isEqualToString:@"nowPrice"]) {
        
        float a = [value floatValue];
        
        self.nowPriceSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"updown"]){
        
        float a = [value floatValue];
        self.updownSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"updownRate"]){
        
        float a = [value floatValue]*100;
        self.updownRateSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"high"]){
        
        float a = [value floatValue];
        self.highSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"open"]){
        
        float a = [value floatValue];
        self.openSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"low"]){
        
        float a = [value floatValue];
        self.lowSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"close"]){
        
        float a = [value floatValue];
        self.closeSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"volume"]){
        
        float a = [value floatValue]/100000000;
        self.volumeSB = [NSString stringWithFormat:@"%.2f",a];
        
    }else if ([key isEqualToString:@"upNum"]){
        
        NSInteger a = [value integerValue];
        self.upNumSB = [NSString stringWithFormat:@"%lu",a];
        
    }else if ([key isEqualToString:@"downNum"]){
        
        NSInteger a = [value integerValue];
        self.downNumSB = [NSString stringWithFormat:@"%lu",a];
        
    }else if ([key isEqualToString:@"flatNum"]){
        
        NSInteger a = [value integerValue];
        self.floatNumSB = [NSString stringWithFormat:@"%lu",a];
        
    }else if ([key isEqualToString:@"post_id"]){
        
        NSInteger a = [value integerValue];
        self.post_idSB = [NSString stringWithFormat:@"%lu",a];
        
    }else if ([key isEqualToString:@"statusTime"]){
        
        NSDate *nd=[NSDate dateWithTimeIntervalSince1970:(float)[value floatValue]];
        NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
        [dateFormatter setDateFormat:@"MM-dd HH:mm"];
        NSString *dateStr=[dateFormatter stringFromDate:nd];
        self.statusTimeSB = dateStr;

    }
    
}




















@end
